package com.example.chuntiao.cophook.ui;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by chuntiao on 17-7-31.
 */

public class MyViewPager extends ViewPager {

    private boolean swipable;

    public void setSwipable(boolean swipable) {
        this.swipable = swipable;
    }

    public MyViewPager(Context context) {
        super(context);
        swipable = true;
    }

    public MyViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
        swipable = true;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return swipable && super.onInterceptTouchEvent(ev);
    }

}
